package alibaba.controller;

import alibaba.service.ConsumerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerController {

    private String  baseUrl  = "http://servie-producer";

    @Autowired
    RestTemplate restTemplate;
    @Autowired
    ConsumerService consumerService;

    @GetMapping(value = "restTemplate/sayHellow")
    public String sayHellow(){
        return restTemplate.getForObject(baseUrl+"/produce/sayHellow",String.class);
    }
    @GetMapping(value = "fegin/sayHellow")
    public String feginSayHellow(){
        return consumerService.feginSayHellow();
    }


}
